package pers.archives.home.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pers.archives.common.constant.ControllerPath;
import pers.archives.common.ov.common.CommonResponse;
import pers.archives.common.ov.OVMenus;
import pers.archives.common.ov.common.ResponseCode;
import pers.archives.common.utils.UserUtil;
import pers.archives.home.service.MenuService;

import java.util.ArrayList;
import java.util.List;

/* 操作菜单
 *@program:archives-parent
 *@author: 赵浩浩
 *@Time: 2020/9/19  14:35
 */
@RestController
@RequestMapping(value = ControllerPath.MENU_PATH)
public class MenuController {

    @Autowired
    private MenuService menuService;

    @PostMapping(value = ControllerPath.GET_MENU)
    public CommonResponse<List<OVMenus>> getMenu(Authentication authentication) {
        List<String> ids = new ArrayList<>();
        return new CommonResponse<>(ResponseCode.HOME_GET_MENU_INFO,
                menuService.getMenu(ids ,UserUtil.getUser()));
    }

}
